package com.shyroke.daydayzhuandao.respository;

import com.shyroke.daydayzhuanapi.entity.MenuEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MenuRepository extends BaseRepository<MenuEntity,Integer>{
    @Query(value = "select m.mid,m.name,m.parentID parentid,m.grade,m.isLeaf is_leaf,m.href,m.icon,m.spread from menu m where m.mid in (select menu_id from role_menu where role_id = ?1) ",nativeQuery = true)
    List<MenuEntity> findByRoleId(Integer roleId);
}
